<?php

namespace app\services;

use plugin\admin\app\model\Dict;

class DictService
{
    public static function get($key)
    {
        $dict = Dict::where('key', $key)->first();

        return $dict['value'] ?? '';
    }

    public static function getAll()
    {
        $dicts = Dict::all()->toArray();

        return array_combine(
            array_column($dicts, 'key'),
            array_column($dicts, 'value')
        );
    }
}